#ifndef DATABASEWIDGET_H
#define DATABASEWIDGET_H

#include <QMainWindow>
#include <QStackedWidget>
#include <QList>

class AbstractCore;
class StyledBar;
class QRuntimeDatabaseView;

struct tagTab
{
    QString     m_text;
    int         m_width;
};

class TabWidget: public QWidget
{
    Q_OBJECT
public:
    TabWidget(QWidget *parent=0);

    void    addItems(const QString &item);

    void    select(QString str);

    void    select(int index);
    QSize   sizeHint() const;
signals:
    void    clicked(int index);
protected:
    void    paintEvent(QPaintEvent *);

    void    mousePressEvent(QMouseEvent *);
protected:
    QList<tagTab>   m_items;
    QString m_select;

};

class DatabaseWidget : public QMainWindow
{
    Q_OBJECT
public:
    explicit DatabaseWidget(AbstractCore* core,QWidget *parent = 0);

    void    addWidget(QString name,QWidget *page);


signals:

public slots:
    void    select(int index);

    void    projectOpen();
    void    projectClosed();
protected:
    AbstractCore        *m_core;

    StyledBar           *m_styledbar;
    QStackedWidget      *m_stackedWidget;
    TabWidget           *m_tabWidget;
    QRuntimeDatabaseView    *m_runtimeView;
};

#endif // DATABASEWIDGET_H
